<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // var a = 1;
        // var b = ++a + ++a + a;
        /**
         *  a   2       3
         *  ++a 2       3     3
         *  b = ++a  +  ++a + a;
         * 
         */
        // console.log(a);//3
        // console.log(b);//8


        var a = 1;
        /**
         *  a    2         3
         *  a++  1  + 1 +  2
         */
        var b = a++ + 1 + a++;

        console.log(a);//3
        console.log(b);//4
    </script>
</body>

</html>